import threading
from time import sleep, time

url_list = []


def get_url_detail(url_list):
    while True:
        if len(url_list) > 0:
            url = url_list.pop()
            print('this is start get get_url_detail({}) !'.format(url))
            sleep(5)
            print('this is end get get_url_detail({}) !'.format(url))


def get_content_url(url_list):
    print('this is start get get_content_url !')
    for i in range(20):
        url_list.append('http://www.baidu.com/p/{}'.format(i))
    sleep(10)
    print('this is end get get_content_url !')


if __name__ == '__main__':
    while True:
        t1 = threading.Thread(target=get_content_url, args=(url_list,))
        for i in range(5):
            detail_thread = threading.Thread(target=get_url_detail, args=(url_list,))
            detail_thread.start()
        t1.start()
